Skip to content

Java: Add manual overlay annotations & discard predicates #19813

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: kaspersv/overlay-java-annotations
Choose a base branch
from

Conversation

kaspersv
Copy link
Contributor

No description provided.

@kaspersv kaspersv force-pushed the kaspersv/overlay-java-discarding branch from 6f5bc41 to 8672313 Compare June 19, 2025 06:34
@kaspersv kaspersv force-pushed the kaspersv/overlay-java-discarding branch from 8672313 to db52a3c Compare June 19, 2025 07:13
// bodies for dependencies. To approximate fully extracted files in
// the overlay, we restrict attention to files that contain an expression
// with an enclosing callable.
exists(@expr e | callableEnclosingExpr(e, _) and file = getRawFile(e))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@smowton suggested in the internal issue for "Java overlay: Low-level accuracy issues" to use the numlines table instead of callableEnclosingExpr to identify non-skeleton files.

I'm fine with postponing that change (and its evaluation) to a follow-up PR.

@@ -26,6 +26,7 @@ import semmle.code.java.KotlinType
import semmle.code.java.Member
import semmle.code.java.Modifier
import semmle.code.java.Modules
import semmle.code.java.Overlay
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import will bring four top-level predicates into the global scope, visible in autocomplete everywhere. I think this would be better as a private import in each of the files that define a discard predicate.

exists(@member m | file = getRawFile(m) and hasJavadoc(m, d))
}

/** Discard javadoc entities in files fully extracted in the overlay. */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we also have discarding rules for comments that aren't Javadoc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants